package com.example.flshtarvel.service;

import com.example.flshtarvel.entity.ArticleCollectMap;
import com.example.flshtarvel.mapper.ArticleCollectMapMappper;
import com.example.flshtarvel.mapper.ArticleLikeMapMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ArticleCollectMapService {
    @Autowired(required = false)
    ArticleCollectMapMappper articleCollectMapMappper;

    //信息收藏
    public int articleCollect(String articleId,String userId){
        int result ;
        ArticleCollectMap articleCollectMap = articleCollectMapMappper.selectArticleCollectByArticleIdAndUserId(articleId,userId);
        if(articleCollectMap==null){
            result = articleCollectMapMappper.articleCollect(articleId,userId);
        }else{
            result = 0;
        }
        return result;
    }
    //取消信息收藏
    public int deleteArticleCollect(String articleId,String userId){
        int result = articleCollectMapMappper.deleteArticleCollect(articleId,userId);
        return result;
    }
}
